<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<ui:composition template="/protected/template/mainLayout.xhtml">
	<ui:define name="content">
		<div id="customer_container">

			<div id="customer_navigationBar">
				<h:form>
					<a4j:repeat value="#{updateCustomerBean.accessPath}" var="menuItem"
						rowKeyVar="rowIndex">
						<h:outputLink value="#{menuItem.url}" onclick="allowRedirect();"
							rendered="#{rowIndex == 0}">
							<h:outputText value="#{menuItem.menuName}" class="rootIndex" />
						</h:outputLink>
						<h:outputText value=" > " rendered="#{rowIndex >0}" />
						<h:outputText value="#{menuItem.menuName}"
							rendered="#{rowIndex >0}" class="currentIndex" />
					</a4j:repeat>
				</h:form>
			</div>
			<div id="customer_form">
				<h:form id="formId">
					<rich:panel>

						<rich:messages globalOnly="true" ajaxRendered="true"
							rendered="false"></rich:messages>

						<h:panelGrid columns="1" width="100%">
							<h:panelGrid columns="4">
								<h:outputLabel value="#{msg.label_customer_search_title}" />
								<h:inputText value="#{updateCustomerBean.keyWord}"
									id="search_key_word"></h:inputText>
								<h:commandButton id="search_button_id"
									actionListener="#{updateCustomerBean.searchCustomer}"
									value="#{msg.button_search}"
									onclick="allowRedirect(); return search_customer(${updateCustomerBean.addTab},'${info.msg_make_sure_not_save}');"></h:commandButton>

							</h:panelGrid>

						</h:panelGrid>

						<div class="line"></div>
						
						<rich:messages layout="list" errorClass="errorMessage" fatalClass="errorMessage" infoClass="systemMessage" warnClass="warnMessage" showSummary="true" showDetail="false" style="background-image:none;" />

						<h:panelGroup id="sumTabId"
							rendered="#{updateCustomerBean.sumTab}">

							<rich:dataScroller for="customerTable" maxPages="5"
								rendered="#{updateCustomerBean.customerList.rowCount>customerBean.tableRows}" />

							<rich:dataTable width="700" var="customerVo"
								rows="#{updateCustomerBean.tableRows}" id="customerTable"
								iterationStatusVar="sta" rowSelection="single"
								value="#{updateCustomerBean.customerList}">
								<f:facet name="header">
									<rich:columnGroup>
										<rich:column colspan="1">
											<h:outputText value="#{msg.label_search_customer_id}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{msg.label_search_customer_name_en}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{msg.label_search_customer_name_simp}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{msg.label_search_customer_name_chi}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{msg.label_search_customer_birthday}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{msg.label_search_customer_phone}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{msg.label_search_customer_email}" />
										</rich:column>
									</rich:columnGroup>
								</f:facet>



								<rich:columnGroup>

									<rich:column>
										<h:commandLink id="customerTableRowId#{sta.index}"
											actionListener="#{updateCustomerBean.toEditCustomer}"
											onclick="allowRedirect();">
											<f:param name="custId" value="#{customerVo.custId}"></f:param>
											<h:outputText value="#{customerVo.custId}">
											</h:outputText>
										</h:commandLink>

									</rich:column>

									<rich:column>
										<h:outputText value="#{customerVo.namEng}">
										</h:outputText>
									</rich:column>

									<rich:column>
										<h:outputText value="#{customerVo.namZhs}">
										</h:outputText>
									</rich:column>

									<rich:column>
										<h:outputText value="#{customerVo.namZht}">
										</h:outputText>
									</rich:column>

									<rich:column>
										<h:outputText value="#{customerVo.birthday}">
										</h:outputText>
									</rich:column>

									<rich:column>
										<h:outputText value="#{customerVo.telNbr}">
										</h:outputText>
									</rich:column>

									<rich:column>
										<h:outputText value="#{customerVo.email}">
										</h:outputText>
									</rich:column>

								</rich:columnGroup>
							</rich:dataTable>
							<rich:dataScroller for="customerTable" maxPages="5"
								rendered="#{updateCustomerBean.customerList.rowCount>customerBean.tableRows}" />

						</h:panelGroup>

						<h:panelGrid columns="2" styleClass="panel-grid-default"
							rendered="#{updateCustomerBean.addTab}" id="addTabId">
							<rich:tabPanel switchType="client" id="addTabPanelId"
								activeItem="#{updateCustomerBean.activeTab}" >


								<c:forEach items="${updateCustomerBean.functionList}" var="func">
								<ui:include src="#{func.uri}">
								    <ui:param name="func" value="#{func}"></ui:param>
								</ui:include>
								</c:forEach>


							</rich:tabPanel>

							<h:panelGroup styleClass="customer-oper-button">

								<h:commandButton id="button_save_id"
									actionListener="#{updateCustomerBean.saveCustomer}"
									value="#{msg.button_save}" disabled="#{updateCustomerBean.cancelledFlag}"
									onclick="allowRedirect(); javascript:if(window.confirm('#{info.msg_make_sure_to_save}')) return true; else return false;"></h:commandButton>
								<h:commandButton id="button_cancel_id"
									actionListener="#{updateCustomerBean.cancelCustomer}"
									value="#{msg.button_cancel}" immediate="true"
									onclick="allowRedirect();javascript:if (window.confirm('#{info.msg_make_sure_to_cancel}')) return true; else return false;"></h:commandButton>
							</h:panelGroup>
						</h:panelGrid>


					</rich:panel>



				</h:form>
			</div>
		</div>
	</ui:define>
</ui:composition>

</html>